<script src="<?=base_url(); ?>theme/js/main.js"></script>
<script type="text/javascript">
                                                            
$(document).ready(function(){
$('.table_top').hide(); //Oculta la parte de búsqueda por defecto de la tabla de productos .
});

</script>

<div class="grid_container">
	<div class="grid_12">
		<div class="widget_wrap">
			<div class="widget_top">
				<span class="h_icon clipboard"></span>
				<h6>Stock de Productos</h6>
			</div>
			<div class="form_container">
				<ul>
					<li>
						<div class="form_grid_12">
					
							<div class="form_input">
							
							<form method="post" action="">
								<div class="form_grid_2 alpha">
									<input name="code" type="text" value="<?php echo $code; ?>">
									<span class=" label_intro">Código</span>
								</div>
								<div class="form_grid_5 ">
									<input name="description" type="text" value="<?php echo $description; ?>" style=" width:80%">
									<span class=" label_intro">Descripción</span>
								</div>
								<div class="form_grid_2 ">
								<input type="submit" class="btn_small btn_blue" value="Buscar">
								</div>
								<span class="clear"></span>
							</form>
							</div>
						</div>
					</li>
				</ul>
			</div>

                    


<div id="view_stock" style="display:none;">
                                

                            </div>
<div class="widget_content">
				<table class="display data_tbl">
					<thead>
						<tr>
							<th>Código</th>
							<th>Descripción</th>
							<th>Precio</th>
							<th>Por Mayor</th>                                                        
							 <!-- <th>Ver Stock</th> --> 
						</tr>
					</thead>
					<tbody>

					<?php $i = 0; ?>
					<?php foreach ($products as $p) : ?>
					    <?php $i++; ?>
                                            
						<tr class="stockProduct tr_even" id="view_stock_<?= $i; ?>" codeProduct="<?php echo $p->code ?>" style="cursor: pointer;">
							<td><?=$p->code; ?></td>
							<td><?=$p->description; ?></td>
							<td align="right">US$ <?=$p->price; ?></td>
							<td align="center"><?=$p->pack_desc; ?></td>
					   <!-- <?php/*


              $i=0;
                            foreach( $listStock as $st){
                            $i++;
                        ?>
                     <table border='0' rules="all" cellpadding="0" cellspacing="0" class='wtbl_list CityTable'>
                       <thead>
                       <tr width="100%">
                        <th width="40%"><input style="width:20px;" type="hidden"  id="cod_almacen<?php echo $i; ?>" name="cod_almacen<?php echo $i; ?>" value="<?php echo $st->id; ?>"><span align="left"><?php echo $i.")";?></span><?php echo $st->name; ?></th>
                         <th width="20%" align="center"><input align="center" class="unitdisponible_<?php echo $i; ?>" value="<?php echo $total_unidades_x_caja_pakete_unidad =  (($productData->box_packs * $productData->pack_units) *  $st->boxes) + ($st->packs * $productData->pack_units ) + $st->Units; ?>" style="width:40px" disabled/></th>
                        <th width="20%" align="center"><input class="cantUnits onlyNumber" id="caja<?php echo $i; ?>" name="caja<?php echo $i; ?>" type="" style="width:40px" placeholder="0" /></th>
                        <th width="20%" align="center"><input class="cantUnits onlyNumber" id="paquete<?php echo $i; ?>" name="paquete<?php echo $i; ?>" type="text"  style="width:40px" placeholder="0" /></th>
                        <th width="20%" align="center"><input class="cantUnits onlyNumber" id="unidad<?php echo $i; ?>" name="unidad<?php echo $i; ?>" type="text" style="width:40px" placeholder="0" /></th>
                       </tr>
                       </thead>
                       
                   
                         <?php
                         $j=0;
                            foreach( $subwarehouses as $s ){
                             $j++;
                             if($st->id == $s->id_warehouse)
                             {
                        ?>
                        <tbody>
                            <tr width="100%">
                           
                        <td width="40%" align="left"><input style="width:20px;" type="hidden"  id="cod_almacen<?php echo $i; ?>" name="cod_almacen<?php echo $i; ?>" value="<?php echo $s->id_warehouse; ?>"><span align="left">       <?php echo $i.")";  ?></span> <?php echo $s->name; ?></td>
                        <td></td>
                        <td width="20%" align="center"><input class="cantUnits onlyNumber" id="caja<?php echo $i; ?>" name="caja<?php echo $i; ?>" type="" style="width:40px" placeholder="0" /></td>
                        <td width="20%" align="center"><input class="cantUnits onlyNumber" id="paquete<?php echo $i; ?>" name="paquete<?php echo $i; ?>" type="text"  style="width:40px" placeholder="0" /></td>
                        <td width="20%" align="center"><input class="cantUnits onlyNumber" id="unidad<?php echo $i; ?>" name="unidad<?php echo $i; ?>" type="text" style="width:40px" placeholder="0" /></td>
                        </tr>                                          
                        </tbody>

                        <?
                    }
                        }
                        ?>                        
                     </table>
            <?
                        }*/?> -->
                                                       
						
                                                            
                                                         <!--    <script type="text/javascript">
                                                                    $(document).ready(function(){
                                                                         
                                                                            $('#view_stock_<?= $i; ?>').click(function(){
                                                                           var codigo = '<?/*=$p->code; */?>'
                                                                            $.ajax({
                                                                                'url' : url+'/stock/stocks2/',
                                                                                'type' : 'POST',
                                                                                'data' : {'code' : codigo},                                                                             
                                                                                'success' : function(res){
                                                                                  $('#view_stock').html(res);
                                                                                }
                                                                            });
                                                                            
                                                                             $('.data_tbl').fadeOut('fast');
                                                                             $('.table_bottom').fadeOut('fast');
                                                                            $('#view_stock').fadeIn('show');
                                                                        });
                                                                        
                                                                       
                                                                        
                                                                    });
                                                            </script>         -->                                               
                                                            
                        </tr>
                           <?php endforeach; ?>               
					</tbody>
				</table>
                            
			</div>
		</div>
	</div>
    
    
    
	<span class="clear"></span>
</div>